home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / UUPC11QS.ARJ / MKMBOX.C < prev    next >
C/C++ Source or Header  |  1991-11-21  |  3KB  |  66 lines

  1. /*--------------------------------------------------------------------*/
  2. /*    m k m b o x . h                                                 */
  3. /*                                                                    */
  4. /*    Host Support routines for UUPC/extended                         */
  5. /*                                                                    */
  6. /*    Changes Copyright 1990, 1991 (c) Andrew H. Derbyshire           */
  7. /*                                                                    */
  8. /*    History:                                                        */
  9. /*       21Nov1991 Break out of hlib.c                         ahd    */
  10. /*--------------------------------------------------------------------*/
  11.  
  12. #include <stdio.h>
  13. #include <stdlib.h>
  14. #include <string.h>
  15. #include <time.h>
  16.  
  17. /*--------------------------------------------------------------------*/
  18. /*                    UUPC/extended include files                     */
  19. /*--------------------------------------------------------------------*/
  20.  
  21. #include "lib.h"
  22. #include "hlib.h"
  23.  
  24. /*--------------------------------------------------------------------*/
  25. /*                          Global variables                          */
  26. /*--------------------------------------------------------------------*/
  27.  
  28. currentfile();
  29.  
  30. /*--------------------------------------------------------------------*/
  31. /*    m k m a i l b o x                                               */
  32. /*                                                                    */
  33. /*    Build a mailbox name                                            */
  34. /*--------------------------------------------------------------------*/
  35.  
  36. char *mkmailbox(char *buf, const char *userid)
  37. {
  38.    boolean append = ( E_mailext != NULL );
  39.  
  40.    if (buf == NULL)           /* Do we need to allocate buffer?         */
  41.    {
  42.       buf = malloc( FILENAME_MAX );
  43.       checkref(buf);
  44.    } /* if */
  45.  
  46.    if (bflag[F_DIRECT])
  47.    {
  48.       sprintf(buf,"%s%c%s%c%s", maildir, SEPCHAR,
  49.                                userid, SEPCHAR,"newmail");
  50.    } /* if (bflag[F_DIRECT]) */
  51.    else {
  52.       mkfilename(buf, maildir, userid);
  53.       append &= (strchr(userid, '.') == NULL );
  54.    } /* else */
  55.  
  56. /*--------------------------------------------------------------------*/
  57. /*              If we need a mailbox extension, add one               */
  58. /*--------------------------------------------------------------------*/
  59.  
  60.    if ( append )
  61.       strcat( strcat(buf,".") , E_mailext );
  62.  
  63.    return buf;
  64.  
  65. } /* mkmailbox */
  66.